package com.bw.user.mvvm.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.ArrayList;
import java.util.List;

public
/**
 * @author Lishaohe
 * @description:
 * @date :2021/10/29 0029 下午 4:02
 *
 */
class VpAdapter extends FragmentStatePagerAdapter {
    List<Fragment> fragments ;
    List<String> list  ;
    public VpAdapter( FragmentManager fm,List<Fragment> fragments,List<String> list ) {
        super(fm);
        this.fragments = fragments;
        this.list = list;
    }

    @NonNull

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Nullable

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position);

    }
}
